package com.pubinfo.passbook.common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.pubinfo.passbook.common.model.dto.engine.EngineDescription;
import com.pubinfo.passbook.common.model.http.engine.ComputeParamSlot;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Collection;

/**
 * @author zhouch
 * @date 2021/12/14 10:01
 */
@Data
@NoArgsConstructor
@TableName(autoResultMap = true)
@ApiModel("计算单元")
public class TEngineComputeUnit {

    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 计算单元名称
     */
    @ApiModelProperty("计算单元名称")
    @NotBlank(message = "计算单元名称不能为空")
    private String name;

    /**
     * 计算单元标识符号
     * {@link com.pubinfo.passbook.engine.constants.ComputeUnitSymbol}
     */
    @ApiModelProperty("计算单元标识符 (谨慎修改)")
    @NotBlank(message = "计算单元标识符不能为空")
    private String symbol;

    /**
     * 计算单元类型
     * {@link com.pubinfo.passbook.engine.constants.ComputeUnitType}
     */
    @ApiModelProperty(EngineDescription.COMPUTE_UNIT_TYPE)
    @NotBlank(message = "计算单元类型不能为空")
    private String type;

    /**
     * 计算链类型
     */
    @ApiModelProperty(EngineDescription.COMPUTE_CHAIN_TYPE)
    @NotBlank(message = "计算链类型不能为空")
    private String chainType;

    /**
     * 参数列表
     */
    @TableField(typeHandler = FastjsonTypeHandler.class)
    @ApiModelProperty("参数插槽列表")
    @NotNull(message = "如果不需要参数插槽则输入一个空数组")
    private Collection<ComputeParamSlot> paramSlots;

    @ApiModelProperty("计算单元描述")
    @NotBlank(message = "计算单元描述不能为空")
    private String description;
}
